using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

public partial class PopUpPages_PrintPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        #region TestConfigurationSessions
        string pathUrl;
        if (Helper.CheckAndGetQueryStrString("path", out pathUrl))
        {
            if (Session["ctrl"] == null)
            {
                Response.Redirect("~/DefaultMain.aspx");

                //Response.StatusCode = 404;
                HttpContext.Current.Response.Flush();
                HttpContext.Current.Response.End();

            }
            //else if (Session["ctrl2"] == null)
            //{
            //    Response.Redirect("~/DefaultMain.aspx");
            //    //Response.StatusCode = 404;
            //    HttpContext.Current.Response.Flush();
            //    HttpContext.Current.Response.End();
            //}
            PrintHelper.PrintContentPage((HtmlGenericControl)Session["ctrl"],
                (HtmlGenericControl)Session["ctrl2"]);
        }
        //oldversion
        //if (!string.IsNullOrEmpty(Request.QueryString["path"]))
        //{
        //    string PathValid = HttpUtility.HtmlEncode(Request.QueryString["path"]);
        //    if (string.Compare(PathValid, Session["PrevPath"].ToString(), true) == 0)
        //    {
        //        PrintHelper.PrintContentPage((HtmlGenericControl)Session["ctrl"],
        //        (HtmlGenericControl)Session["ctrl2"]);
        //    }
        //    else
        //    {
        //        Response.Redirect(Session["PrevPath"].ToString());
        //    }
        //}
        //else
        //{
        //    Response.Redirect(Session["PrevPath"].ToString());
        //}
        #endregion
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
        return;
    }
}
